
package com.ojoin.trade.supplyloan_core.web.service;

import java.util.List;
import java.util.Map;

import com.ojoin.trade.supplyloan_core.web.domain.*;
import org.springframework.data.domain.Pageable;

import com.ojoin.trade.common.exception.BusinessException;
import com.ojoin.trade.common.web.service.BaseService;

/**
 * Created with IntelliJ IDEA. User: Administrator Date: 15-10-28 Time: 下午2:22
 * To change this template use File | Settings | File Templates.
 */
public interface TbSlPlatformUserService extends BaseService<TbSlPlatformUser> {

	public int deleteByJoinId(int joinId) throws BusinessException;

	public void deleteByJoinAndId(int joinid, int id) throws BusinessException;

	/**
	 * 新增电商平台的用户
	 * 
	 * @param uservo
	 * @throws BusinessException
	 */
	public void insertTbSlPlatformUser(TbSlPlatformUser uservo)
			throws BusinessException;

	/**
	 * 批量清空并新增电商平台用户
	 * 
	 * @param list
	 * @throws BusinessException
	 */
	public void insertAndDeleteSlPlatformUser(List<TbSlPlatformUser> list)
			throws BusinessException;

	 
	/**
	 * 更新电商平台用户的数据
	 * 
	 * @param map
	 * @throws BusinessException
	 */
	public void updateTbSlPlatFormUser(Map<String, Object> map)
			throws BusinessException;

	/**
	 * 根据平台用户名查询某类平台的用户
	 * 
	 * @param platformName
	 * @return
	 * @throws BusinessException
	 */
	public List<TbSlPlatformUser> queryTbSlPlatformUser(String platformName)
			throws BusinessException;

	/**
	 * 根据平台用户名模糊查询某类平台的用户
	 * 
	 * @param platformName
	 * @return
	 * @throws BusinessException
	 */
	public List<TbSlPlatformUser> queryVagueByName(String platformName)
			throws BusinessException;

	/**
	 * 查询join用户的某类平台的账号
	 * 
	 * @param platformName
	 * @param joinid
	 * @return
	 * @throws BusinessException
	 */

	public List<TbSlPlatformUser> queryTbSlPlatformUserByJoinid(
			String platformName, int joinid) throws BusinessException;
	
	public List<TbSlPlatformUser> queryTbSlPlatformUserByJoinid(int joinid) throws BusinessException;
	

	/**
	 * 查询join用户的所有电商平台账号
	 * 
	 * @param idOfTbMerchantUser
	 * @return
	 * @throws BusinessException
	 */
	public List<TbSlPlatformUserVO> selectAllPlatformUserListByJoinID(
			int idOfTbMerchantUser, Pageable page) throws BusinessException;

	/**
	 * 查询join用户的所有需执行抓取任务的电商平台账号
	 * 
	 * @param idOfTbMerchantUser
	 * @return
	 * @throws BusinessException
	 */
	public List<TbSlPlatformUser> selectPlatformUserListByJoinID(
			int idOfTbMerchantUser) throws BusinessException;

	/**
     * 更新电商平台用户的启用状态
     * @param id
     * @param status
     * @return
     * @throws BusinessException
     */
    public int updatePlatformUserEnableflagById(int id, String enableflag) throws BusinessException;

    /**
     * 更新电商平台用户的启用状态
     * @param id
     * @param joinuserid
     * @param status
     * @return
     * @throws BusinessException
     */
    public int updatePlatformUserEnableflagByPIdAndJId(int id, int joinuserid, String enableflag) throws BusinessException;

	/**
	 * 更新九盈用户的所有电商平台用户的启用状态
	 * 
	 * @param id
	 * @param status
	 * @return
	 * @throws BusinessException
	 */
	public int updatePlatformUserEnableflagByJoinuserId(int joinuserid,
			String enableflag) throws BusinessException;

	/**
	 * 查询指定九盈用户是否存在状态为申请暂停的电商平台用户
	 * 
	 * @param joinuserid
	 * @return
	 * @throws BusinessException
	 */
	public int isExistPausedPlatformUserByJoinuserId(int joinuserid)
			throws BusinessException;

	/**
	 * 根据九盈用户、电商平台名、启用状态查询电商平台用户列表
	 * 
	 * @param joinuserid
	 * @param platform_name
	 * @param enable_flag
	 * @return
	 */
	public List<TbSlPlatformUserVO> selectPlatformUserListByNameAndFlag(
			String joinuserid, String platform_name, String enable_flag)
			throws BusinessException;

	/**
	 * 根据九盈用户查询其在各电商平台的可提限额详细列表
	 * 
	 * @param joinuserid
	 * @return
	 */
	public List<TbSlPlatformUserWithdrawVO> selectPlatformUserWithdrawListByJoinuserId(
			int joinuserid) throws BusinessException;

	/**
	 * 给电商平台用户授信
	 * 
	 * @param id
	 * @param joinuserid
	 * @param operatorJoinuserid
	 * @param discount
	 * @param rate
	 * @param fee
	 * @param max_amount
	 * @param credit_certificate
	 * @param clientTs
	 * @throws com.ojoin.trade.common.exception.BusinessException
	 */
	public void updatePlatformUserCredit(TbSlPlatformUser vo)
			throws BusinessException;

	public void updatePlatformUserCredit(TbSlPlatformUserVO vo)
			throws BusinessException;
	
	/**
	 * 根据九盈用户查询未授信的电商平台个数
	 * 
	 * @param joinuserid
	 * @return
	 * @throws BusinessException
	 */
	public int selectUncreditPlatformUserByJoinuserId(int joinuserid)
			throws BusinessException;

	
	  /**
     * 根据九盈用户、电商平台名、启用状态查询电商平台用户列表
     * @param joinuserid
     * @param platform_name
     * @param enable_flag
     * @return
     */
    public List<TbSlPlatformUserVO> selectPlatformUserListByNameAndFlag(String joinuserid, String platform_name, String enable_flag,Pageable page) throws BusinessException;
    
	/**
	 * 更新电商平台用户的密码
	 * @param joinuserid
	 * @param platformuserid
	 * @param newpwd
	 * @throws BusinessException
	 */
	public void updateTbSlPlatFormUserPwd(int joinuserid, int platformuserid, String oldpwd, String newpwd)
			throws BusinessException;

    /**根据id查询平台信息
     ** @param id
     * @return
     * @throws BusinessException
     */

    public TbSlPlatformUser selectPlatformById(int id)throws BusinessException;

    /**
     * 更新电商平台信息的征信相关内容
     * @param infovo
     * @throws BusinessException
     */
	public void updatePlatformUserCreditCheckInfo(TbSlCreditInfo infovo)
			throws BusinessException;
	
	/**
	 * 平台信息按可提限额排序
	 * @param withdrawvos
	 * @return
	 */
	public List<TbSlPlatformUserWithdrawVO> sortPlatformUserWithdrawVOByAvailableCredit(List<TbSlPlatformUserWithdrawVO> withdrawvos);

	/**
	 * 更新九盈用户的所有电商平台的征信信息
	 * 
	 * @param joinuserid
	 * @param creditinfoid
	 * @return
	 * @throws BusinessException
	 */
	public int updateMerchantUserCreditInfoByJoinuserId(int joinuserid,
			int creditinfoid) throws BusinessException;
	
	/**
	 * 更新九盈用户的所有电商平台的征信信息
	 * @param infovo
	 * @throws BusinessException
	 */
	public void updateMerchantUserCreditCheckInfo(TbSlCreditInfo infovo)
			throws BusinessException;
	
	/**
	 * 更新申请平台的上下游合同(同一个合同zip)
	 * @param fileId
	 * @throws BusinessException
	 */
	public void updateApplyPlatformWithUpDownStreamContract(int joinid ,String fileId) throws BusinessException;

    public List<TbPlatformExpireVo> queryTbPlatformExpire(int joinuserid)throws BusinessException;


}

